package org.klaoye.musicplayer.bean;

import android.app.ActivityManager;
import android.content.Context;
import android.util.Log;

import java.util.List;

public class Tools {

    public static boolean isServiceRunning(Context context, String name) {
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningServiceInfo> list = manager.getRunningServices(100);
        for (ActivityManager.RunningServiceInfo info : list) {
            Log.i("RunningService", info.toString());
            if (info.service.equals(name)) {
                return true;
            }
        }
        return false;
    }

}